package com.chuanyang.driverh.mainhome;


import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RadioGroup;

import com.chuanyang.driverh.R;
import com.chuanyang.driverh.base.BaseTitleActivity;
import com.chuanyang.driverh.mainhome.fragment.QualifyFraggment;
import com.chuanyang.driverh.utils.eventbus.RefleshQualityEvent;


public class FleetJoinApplyActivity extends BaseTitleActivity {

    private LinearLayout ll_container;
    private RadioGroup rg_top;
    private ImageView iv_search_back;
    //private QualifyFraggment frag;
    //private int type;

    @Override
    protected int getContentResId() {
        return R.layout.home_act_fleet_join_apply;
    }

    @Override
    protected void initView(Bundle savedInstanceState) {
        hideTitleBar();
        iv_search_back = (ImageView) findViewById(R.id.iv_search_back);
        ll_container = (LinearLayout) findViewById(R.id.ll_container);
        rg_top = (RadioGroup) findViewById(R.id.rg_top);
    }

    @Override
    protected void initData() {
//        frag=new QualifyFraggment();
//        FragmentManager fm = getSupportFragmentManager();
//        if (ll_container.getChildCount()>0)ll_container.removeAllViews();
//        fm.beginTransaction().add(R.id.ll_container,frag  ).commit();
    }

    @Override
    protected void initListener() {
        iv_search_back.setOnClickListener(this);
        rg_top.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                switch (checkedId){
                    case R.id.rb_top1:
                        //type=0;
                         //postRefresh();


                         break;
                    case R.id.rb_top2:
                        //type=1;
                        //postRefresh();


                        break;
                }
            }
        });
    }

    private void postRefresh(){

        //frag.refresh(ispersonal,type);

    }

    public void onEventMainThread(RefleshQualityEvent event) {
        postRefresh();
    }


    @Override
    public void onClick(View v) {
        super.onClick(v);
        switch (v.getId()) {
            case  R.id.iv_search_back:
                finish();
                break;
        }
    }
}
